package com.ys.web.ws.send.po;

import com.ys.utils.base.j2se.StringHandler;
import lombok.Data;
import lombok.experimental.Accessors;
import tk.mybatis.mapper.entity.IDynamicTableName;

import javax.persistence.*;

/**
 * @ 名称:群聊天对象
 * @ 创建人: dhf
 * @ 参数： null
 * @ 创建时间: 2022/5/11
 * @ 修改人和其它信息
 * @ 返回值:
 */
@Data
@Accessors(chain = true)
public class GChatPO implements IDynamicTableName {
    @Override
    public String getDynamicTableName() {
        if (StringHandler.isEmpty(this.tableName)) {
            throw new RuntimeException("请设置表名");
        }
        return tableName;
    }

    /**
     * 表名
     */
    @Transient
    public String tableName;

    /**
     * 主键
     */
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    public Long id;

    /**
     * 发送用户id
     */
    @Column(name = "`from`")
    public Long from;

    /**
     * 发送者名称
     */
    public String fromName;

    /**
     * 发送者头像
     */
    public String fromAvatarUrl;

    /**
     * 组 id
     */
    @Column(name = "`to`")
    public Long to;

    /**
     * 消息类型
     */
    @Column(name = "`code`")
    public Integer code;

    /**
     * 数据
     */
    public String data;

    /**
     * 创建时间
     */
    public String createTime;

    /**
     * 图片宽度
     */
    public double width;

    /**
     * 图片高度
     */
    public double height;

    /**
     * 消息唯一标识符
     */
    public String messageId;

    public String soundSeconds;

    public String toMembers;

    public String getTableName() {
        return tableName;
    }

    public void setTableName(String tableName) {
        this.tableName = tableName;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getFrom() {
        return from;
    }

    public void setFrom(Long from) {
        this.from = from;
    }

    public String getFromName() {
        return fromName;
    }

    public void setFromName(String fromName) {
        this.fromName = fromName;
    }

    public String getFromAvatarUrl() {
        return fromAvatarUrl;
    }

    public void setFromAvatarUrl(String fromAvatarUrl) {
        this.fromAvatarUrl = fromAvatarUrl;
    }

    public Long getTo() {
        return to;
    }

    public void setTo(Long to) {
        this.to = to;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getData() {
        return data;
    }

    public void setData(String data) {
        this.data = data;
    }

    public String getCreateTime() {
        return createTime;
    }

    public void setCreateTime(String createTime) {
        this.createTime = createTime;
    }

    public double getWidth() {
        return width;
    }

    public void setWidth(double width) {
        this.width = width;
    }

    public double getHeight() {
        return height;
    }

    public void setHeight(double height) {
        this.height = height;
    }

    public String getMessageId() {
        return messageId;
    }

    public void setMessageId(String messageId) {
        this.messageId = messageId;
    }

    public String getSoundSeconds() {
        return soundSeconds;
    }

    public void setSoundSeconds(String soundSeconds) {
        this.soundSeconds = soundSeconds;
    }

    public String getToMembers() {
        return toMembers;
    }

    public void setToMembers(String toMembers) {
        this.toMembers = toMembers;
    }
}
